package org.ym.file.domain.common.enums;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * @author ym
 */
@Converter
public class FileStoreTypeConverter implements AttributeConverter<FileStoreType,Integer> {
    @Override
    public Integer convertToDatabaseColumn(FileStoreType attribute) {
        return attribute.getCode();
    }

    @Override
    public FileStoreType convertToEntityAttribute(Integer dbData) {
        return FileStoreType.of(dbData);
    }
}
